Field
This disclosure relates generally to data processors, and more specifically, to managing return stacks in a multi-threaded data processing system.
Related Art
Branch target buffers (BTBs) are typically used within data processing systems to improve branch performance. BTBs act as a cache of recent branches and can accelerate branches by providing a branch target address prior to execution of the branch instruction, which allows a processor to more quickly begin execution of instructions at the branch target address. In conjunction with a BTB, an associated return stack is used for storing return addresses for subroutine calls. For example, within a thread, branches to subroutines (such as branch and link instructions) and returns from subroutines (such as branch to link instructions) are also stored in the BTB. Therefore, when a new branch to subroutine is stored into the BTB or a branch to subroutine hits in the BTB, a return address corresponding to the branch to subroutine is pushed onto the return stack. When a new branch from subroutine is stored into the BTB or a branch from subroutine hits in the BTB, a pop from the stack is performed to provide the return address. This allows program execution to continue at the appropriate location. In a multi-threaded processor, each thread typically has its own private BTB and associated return stack. When sufficient space is not available in a return stack, branch performance is reduced. However, increasing the size of the return stacks for the threads increases circuit area and power, which results in increased cost. Therefore, there is a need for improved return stacks for use within a multi-threaded system which does not significantly increase area or power.